package com.mng.controller;


import com.mng.dto.User;
import org.springframework.stereotype.Controller;
import org.springframework.web.bind.annotation.RequestMapping;
import org.springframework.web.bind.annotation.ResponseBody;

@Controller
public class HelloController {
    //  通过@RequestMapping注解，可以通过请求路径匹配要处理的具体的请求
    //  /表示的当前工程的上下文路径
    @RequestMapping("/")
    public String index() throws Exception {
        throw new Exception();
        //return "redirect:sstarget";
    }

    @RequestMapping("/sstarget")
    public String toTarget(){
        return "target";
    }

    @RequestMapping("/success")
    @ResponseBody
    public User success(){
        User user = new User("minangong",13);
        return user;
    }
}
